1. Field of the Invention
The present invention relates to an image pickup apparatus which acquires a plurality of images while causing a focus position to change and adjusts the focus position so that a peak value of contrast evaluation values is taken, and a method for operating the image pickup apparatus.
2. Description of the Related Art
As range finding systems for acquiring information about a distance to a subject, an active system in which infrared light or ultrasound is radiated to a subject to detect a distance on a basis of a time period required until a reflected wave returns or a radiation angle, and a passive system in which an image acquired via an optical system is used to perform range finding without using infrared light and the like are known.
Among the systems, examples of the passive system include phase difference AF (autofocus) used in a single-lens reflex camera and the like and contrast AF widely used in a video camera, a compact camera and the like. The phase difference AF requires, for example, an AF sensor. Therefore, in a small-sized image pickup apparatus such as an endoscope, the contrast AF in which an image picked up by an image pickup section can be used to perform AF is relatively widely used.
The contrast AF is an AF system in which a plurality of (generally, three or more) frame images are acquired while a focus lens is driven and a focus position is being changed, and a focus position where a maximum (peak) contrast evaluation value among contrast evaluation values of the acquired images (for example, high-frequency components of the images) is obtained is set as a focal point. Various techniques related to such contrast AF have been conventionally proposed.
For example, Japanese Patent Application Laid-Open Publication No. 2009-133903 describes a technique in which detection of a peak position on a basis of contrast of images is not performed when motion of an object is fast, and, by successively performing movement to a predicted focus position, motion of a focus lens is caused to follow the motion of the object in a state that some level of focusing accuracy is secured.
Further, Japanese Patent Application Laid-Open Publication No. 2012-108313 describes a technique in which a first focusing processing section and a second focusing processing section are provided, and, when it is judged that focusing by the first focusing processing section has been performed, processing is switched from the first focusing processing section to the second focusing processing section. Here, the first focusing processing section is, for example, contrast AF focusing processing section. On the other hand, the second focusing processing section is a focusing processing section which performs AF based on average luminance of images, a focusing processing section which performs AF based on frequency characteristics of luminance images, a focusing processing section which performs AF based on motion vectors detected from local regions of luminance images, or the like.
Furthermore, Japanese Patent Application Laid-Open Publication No. 2010-204585 describes a technique in which detection of motion of an object image is also performed when contrast AF is performed, and, though a position is changed on a basis of a motion detection result for a focus detection region, the position is changed on a basis of a result of addition of motion detections for an AF frame, and the AF frame is changed with a characteristic different from a characteristic for the focus detection region to suppress a feeling of flickering which occurs at time of causing the AF frame to move.